﻿if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RemindersQueueItemInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].RemindersQueueItemInsert
GO
                    
CREATE PROCEDURE dbo.RemindersQueueItemInsert
(
	@RemindersQueueID int,
	@SiteID uniqueidentifier,
	@SiteTitle nvarchar(200),
	@SiteUrl nvarchar(1000),
	@FromAddress nvarchar(500),
	@PreservationNoticeTemplateID int,
	@OriginalPreservationNoticeHistoryID int,
	@MessageSubject nvarchar(500),
	@ReminderType nvarchar(50),
	@CustodianID int,
	@CustodianEmail nvarchar(500),
	@CustodianFirstName nvarchar(200),
	@CustodianLastName nvarchar(200),	
	@Created datetime,
	@Modified datetime,
	@RemindersQueueItemID int OUTPUT
)
AS

SET NOCOUNT ON

INSERT INTO dbo.RemindersQueueItem
(
	RemindersQueueID,
	SiteID,
	SiteTitle,
	SiteUrl,
	FromAddress,
	PreservationNoticeTemplateID,
	OriginalPreservationNoticeHistoryID,
	MessageSubject,
	ReminderType,
	CustodianID,
	CustodianEmail,
	CustodianFirstName,
	CustodianLastName,	
	Created,
	Modified
)
VALUES
(
	@RemindersQueueID,
	@SiteID,
	@SiteTitle,
	@SiteUrl,
	@FromAddress,
	@PreservationNoticeTemplateID,
	@OriginalPreservationNoticeHistoryID,
	@MessageSubject,
	@ReminderType,
	@CustodianID,
	@CustodianEmail,
	@CustodianFirstName,
	@CustodianLastName,	
	@Created,
	@Modified
)

SET @RemindersQueueItemID = SCOPE_IDENTITY()
GO   